﻿<%@ WebHandler Language="C#" Class="searchSuggestion" %>

using System;
using System.Web;
using System.Collections.Generic;
using System.Web.Script.Serialization;

public class searchSuggestion : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        string kw = context.Request["term"];
        BLL.Search bllsearch = new BLL.Search();
        List<string> list = new List<string>();
        List< MODEL.Search > models= bllsearch.getSuggestion(kw);
        foreach (MODEL.Search item in models)
        {
            list.Add(item.KeyWord);
        }
        JavaScriptSerializer js= new JavaScriptSerializer();
        //转换成json格式
        string json = js.Serialize(list);
        context.Response.Write(json);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}